# eric7.EricWidgets.EricFileDialog

Module implementing alternative functions for the QFileDialog static methods.

### Global Attributes

DontConfirmOverwrite
DontResolveSymlinks
DontUseCustomDirectoryIcons
DontUseNativeDialog
HideNameFilterDetails
Option
ReadOnly
ShowDirsOnly

### Classes

None

### Functions

__reorderFilter | Private function to reorder the file filter to cope with a KDE issue introduced by distributor's usage of KDE file dialogs.
getExistingDirectory | Module function to get the name of a directory.
getExistingDirectoryPath | Module function to get the path of a directory.
getOpenFilPathsAndFilter | Module function to get a list of paths of files for opening and the selected file name filter.
getOpenFileAndDirNames | Module function to get the names of files and directories for opening.
getOpenFileAndDirPaths | Module function to get the paths of files and directories for opening.
getOpenFileName | Module function to get the name of a file for opening it.
getOpenFileNameAndFilter | Module function to get the name of a file for opening it and the selected file name filter.
getOpenFileNames | Module function to get a list of names of files for opening.
getOpenFileNamesAndFilter | Module function to get a list of names of files for opening and the selected file name filter.
getOpenFilePath | Module function to get the path of a file for opening it.
getOpenFilePathAndFilter | Module function to get the path of a file for opening it and the selected file name filter.
getOpenFilePaths | Module function to get a list of paths of files for opening.
getSaveFileName | Module function to get the name of a file for saving.
getSaveFileNameAndFilter | Module function to get the name of a file for saving and the selected file name filter.
getSaveFileNameWithExtension | Module function to get the name of a file for saving ensuring it has a file extension.
getSaveFilePath | Module function to get the path of a file for saving.
getSaveFilePathAndFilter | Module function to get the path of a file for saving and the selected file name filter.
getSaveFilePathWithSuffix | Module function to get the path of a file for saving ensuring it has a file suffix.

## __reorderFilter

__reorderFilter(filterStr, initialFilter="")

Private function to reorder the file filter to cope with a KDE issue introduced by distributor's usage of KDE file dialogs.

filterStr (str)
  Qt file filter
initialFilter (str (optional))
  initial filter (defaults to "")

Return:
  the rearranged Qt file filter

Return Type:
  str

Up

## getExistingDirectory

getExistingDirectory(parent=None, caption="", directory="", options=QFileDialog.Option.ShowDirsOnly)

Module function to get the name of a directory.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to QFileDialog.Option.ShowDirsOnly)

Return:
  name of selected directory

Return Type:
  str

Up

## getExistingDirectoryPath

getExistingDirectoryPath(parent=None, caption="", directory="", options=QFileDialog.Option.ShowDirsOnly)

Module function to get the path of a directory.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to QFileDialog.Option.ShowDirsOnly)

Return:
  path of selected directory

Return Type:
  pathlib.Path

Up

## getOpenFilPathsAndFilter

getOpenFilPathsAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get a list of paths of files for opening and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  list of file paths to be opened and selected filter

Return Type:
  tuple of (list of pathlib.Path, str)

Up

## getOpenFileAndDirNames

getOpenFileAndDirNames(parent=None, caption="", directory="", filterStr="", options=None)

Module function to get the names of files and directories for opening.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  names of the selected files and folders

Return Type:
  list of str

Up

## getOpenFileAndDirPaths

getOpenFileAndDirPaths(parent=None, caption="", directory="", filterStr="", options=None)

Module function to get the paths of files and directories for opening.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  paths of the selected files and folders

Return Type:
  list of pathlib.Path

Up

## getOpenFileName

getOpenFileName(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the name of a file for opening it.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  name of file to be opened

Return Type:
  str

Up

## getOpenFileNameAndFilter

getOpenFileNameAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the name of a file for opening it and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  name of file to be opened and selected filter

Return Type:
  tuple of (str, str)

Up

## getOpenFileNames

getOpenFileNames(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get a list of names of files for opening.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  list of file names to be opened

Return Type:
  list of str

Up

## getOpenFileNamesAndFilter

getOpenFileNamesAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get a list of names of files for opening and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  list of file names to be opened and selected filter

Return Type:
  tuple of (list of str, str)

Up

## getOpenFilePath

getOpenFilePath(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the path of a file for opening it.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  path of file to be opened

Return Type:
  pathlib.Path

Up

## getOpenFilePathAndFilter

getOpenFilePathAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the path of a file for opening it and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  path of file to be opened and selected filter

Return Type:
  tuple of (pathlib.Path, str)

Up

## getOpenFilePaths

getOpenFilePaths(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get a list of paths of files for opening.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  list of file paths to be opened

Return Type:
  list of pathlib.Path

Up

## getSaveFileName

getSaveFileName(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the name of a file for saving.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  name of file to be saved

Return Type:
  str

Up

## getSaveFileNameAndFilter

getSaveFileNameAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the name of a file for saving and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  name of file to be saved and selected filter

Return Type:
  tuple of (str, str)

Up

## getSaveFileNameWithExtension

getSaveFileNameWithExtension(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the name of a file for saving ensuring it has a file extension.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  name of file to be saved

Return Type:
  str

Up

## getSaveFilePath

getSaveFilePath(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the path of a file for saving.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  path of file to be saved

Return Type:
  pathlib.Path

Up

## getSaveFilePathAndFilter

getSaveFilePathAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the path of a file for saving and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str or pathlib.Path (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  path of file to be saved and selected filte

Return Type:
  tuple of (pathlib.Path, str)

Up

## getSaveFilePathWithSuffix

getSaveFilePathWithSuffix(parent=None, caption="", directory="", filterStr="", initialFilter="", options=None)

Module function to get the path of a file for saving ensuring it has a file suffix.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
options (QFileDialog.Options ((optional))
  various options for the dialog (defaults to None)

Return:
  name of file to be saved

Return Type:
  str

Up